package com.nelson.musicplayer

import com.nelson.musicplayer.base.BaseActivity
import com.nelson.musicplayer.databinding.ActivityMainBinding
import com.nelson.musicplayer.manager.FragmentManager
import com.roughike.bottombar.OnTabSelectListener

class MainActivity : BaseActivity<ActivityMainBinding>(), OnTabSelectListener {

    override fun getContentView(): Int = R.layout.activity_main

    override fun initData() {
        mViewDataBinding.bottomBar.setOnTabSelectListener(this)
    }

    override fun onTabSelected(tabId: Int) {
        val fragment = FragmentManager.getFragment(tabId)
        fragment?.let { supportFragmentManager.beginTransaction().replace(R.id.content_container, fragment).commit() }
    }

}
